﻿using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace LabMS.Web.Post.BBS
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class DeleteReply : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string idJson = System.Web.HttpContext.Current.Server.UrlDecode(context.Request.Form.ToString());

                LabMS.Model.PostReply ppInfo = (LabMS.Model.PostReply)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(idJson, typeof(LabMS.Model.PostReply));

                LabMS.BLL.PostReply pr = new LabMS.BLL.PostReply();

                pr.Delete(ppInfo.ID);

                context.Response.ContentType = "application/json";
                context.Response.Write("{success: true}");
            }
            catch
            {
                context.Response.ContentType = "application/json";
                context.Response.Write("{error: true}");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
